<template>
  <f7-page>
    <f7-navbar back-link="Back" title="目录">

    </f7-navbar>
    <f7-list
      virtual-list
      :virtual-list-params="{bookIndexList:bookIndexList}"
    >
      <f7-list-item
        v-for="(item,index) in bookIndexList"
        :title="item.chapterTitle"
        :key="index"
        :link="`/readbook?bookid=${bookid}&chapterid=${item.chapterid}`"
      >
      </f7-list-item>

    </f7-list>
  </f7-page>

</template>

<script>
    import Config from "../js/config";
    import LocalSave from "../js/localSave";

    export default {
      data:function () {
        var options = this.$f7route.query;
        return {
          bookid:options.bookid,
          bookIndexList:{}
        }
      },
      created:function () {
        var c = new Config();
        var ls = new LocalSave();
        var r = this.$request;
        var that = this;
        var url = c.baseUrl +"/book/getindex/"+this.bookid;
        r.get(url,function (res) {
          console.log(res)
          var remoteData = JSON.parse(res);
          that.bookIndexList = remoteData.data;
        })

      },
      methods:{

      }
    }
</script>

<style scoped>

</style>
